package com.example.domain.enums;

import lombok.Getter;

@Getter
public enum OrderStatus {

    UN_PAY("未支付", 1),

    PAID("已支付", 2),

    CANCEL("已取消", 3),

    BACK("已退款", 4),

    FINALLY("已完成", 5),

    COMMENT("已评论", 6);


    private final String msg;
    private final Integer num;


    OrderStatus(String msg, Integer num) {
        this.msg = msg;
        this.num = num;
    }

    public static OrderStatus getOrderStatus(String msg) {
        for (OrderStatus element : OrderStatus.values()) {
            if (element.getMsg().equalsIgnoreCase(msg)) {
                return element;
            }
        }
        return null;
    }

    public static OrderStatus getOrderStatus(Integer num) {
        for (OrderStatus element : OrderStatus.values()) {
            if (element.getNum().equals(num)) {
                return element;
            }
        }
        return null;
    }


}
